﻿using System; 
using System.Text;
using System.Windows.Forms;
using VinMessageBox;

namespace VinMessageBox
{
    internal partial class frmMsgBox : Form
    {
        bool form_showing = true;

        public frmMsgBox(VinMessageBox settings)
        {
            InitializeComponent();
            this.label1.Text = "This message box will close automatically in "+ settings.SecondsToShow  +" seconds";
            this.timer.Interval = settings.SecondsToShow  * 1000;
            timer.Enabled = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            form_showing = false;
        }

        private void loadTimer_Tick(object sender, EventArgs e)
        {
            if (form_showing == true)
            {
                if (Opacity<1)Opacity = Opacity + 0.1;
            }
            else
            {
                if (Opacity > .1)  Opacity = Opacity - .1;
                else Close(); 
            }
        }

        private void frmMsgBox_Load(object sender, EventArgs e)
        {

        }

        private void timer_Tick(object sender, EventArgs e)
        {
            form_showing = false;
        }
    }
}
